<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0 user-scalable=yes">
    <link href="css/jquery.mobile-1.2.0.min.css" rel="stylesheet" type="text/css" />
    <link href="css/common.css" rel="stylesheet" />
    <link href="css/waterfall.css" rel="stylesheet" />
    <!--<link href="css/jquery.mobile.structure-1.2.0.min.css" rel="stylesheet" type="text/css" />
    <link href="css/jquery.mobile.theme-1.2.0.min.css" rel="stylesheet" type="text/css" />-->
    <!--<link href="css/reset.css" rel="stylesheet" type="text/css" />-->
    <!--<link href="css/style.css" rel="stylesheet" type="text/css" />-->
    <script src="js/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="js/jquery.mobile-1.2.0.min.js" type="text/javascript"></script>
    <script src="js/phonegap.js"></script>
    <script src="js/ChildBrowser.js"></script>
    <script src="js/Oup.Http.URL.js"></script>
    <script src="js/waterfall.js"></script>
    <script src="js/config.js"></script>
    <script src="js/cookie.js"></script>
    <script type="text/javascript">
        var opt = {
            getResource: function (index, render) {
                GetList(render);
            },
            auto_imgHeight: true,
            insert_type: 1,
            column_width: 100,
            column_space: 2
        };
        var pageIndex = 1;
        function GetList(render) {
            var uid = window.HtmlContent.getUserId();
            if (uid != null && uid > 0) {
                $.ajax({
                    type: "get",
                    async: true,
                    url: apihost + "/fav/my",
                    dataType: "json",
                    ceche: true,
                    data: { uid: uid, type: "product", cut: 1, simg_width: 90, page: pageIndex },
                    jsonp: "data",//服务端用于接收callback调用的function名的参数
                    jsonpCallback: "success_jsonpCallback",//callback的function名称
                    success: function (json) {
                        pageIndex++;
                        var result = "";
                        for (var i = 0; i < json.data.length; i++) {
                            var d = json.data[i];
                            result += '<div class="cell" val="' + d.id + '">';
                            result += '<a val="' + d.id + '" name="produce" href="#">';
                            result += '<img src="' + d.simg + '" />';
                            //result += '<p class="title">' + d.title + '</p>';
                            result += '</a></div>';
                        }
                        if (result != "") {
                            if (render == null) {
                                $('#container').html(result);
                                $('#container').waterfall(opt);
                            } else {
                                render($(result));
                            }
                            $('#container').isResize(true);
                        }
                        $(".cell").bind("taphold", function(event) { 
                            $(this).html("Tapped and held"); 
                        });
                    },
                    error: function () {

                    }
                });
            }
        }
    </script>
    <style type="text/css">
        #title
        {
            text-align: center;
            color: #006699;
            font-weight: bold;
            font-size: 16px;
            background-color: #CCCCCC;
            margin-top: 5px;
            padding: 10px 10px 20px 10px;
        }

        .title
        {
            font-size: 12px;
        }
    </style>
</head>
<body>
    <div data-role="page" id="page1">
        <div data-theme="b" data-role="header" class="ui-header ui-bar-b" role="banner" data-position="fixed" style="position: fixed;border-width: 0px 0px 1px;">
            <h1 class="ui-title" role="heading" aria-level="1">我的收藏
            </h1>
        </div>
        <div id="container" role="main" data-role="content">
        </div>
        <a style="display: none;" id="login" href="loginDialog.html" data-theme="b" data-icon="" data-rel="dialog" data-transition="pop">登陆
        </a>
        <script type="text/javascript">
	        $(document).bind('pageinit', function () {
	        	if(typeof(window.HtmlContent)!="undefined" && typeof(window.HtmlContent.getUserId)!="undefined" && window.HtmlContent.getUserId()>0)
	    		{
	        		GetList(null);
	        		$("a[name='produce']").live("click", function () {
	                    $('#container').isResize(false);
	                    $.waterfall.isScroll = false;
	                    location.href='detail.html?id=' + $(this).attr("val");
	                    //$.mobile.changePage('detail.html?id=' + $(this).attr("val"), { changeHash: true });
	                });
	                $(window).bind('scroll', function () {
	                    if ($("#rq_ProductDetail").length == 0 && $("div[role='banner']").length == 1) {
	                        $.waterfall.isScroll = true;
	                    } else {
	                        $.waterfall.isScroll = false;
	                    }
	                });
	    		}
		    	else
		    		{location.href="?checklogin=1";}
		    	
		    	$(".cell").live("taphold", function(event) { 
		            var id=$(this).attr("val");
		            location.href="?myDetailMenu=1&id="+id;
		        });
	        });
        </script>
        <div data-role="footer" class="ui-footer ui-bar-a" role="contentinfo" data-position="fixed" style="position: fixed;">
            <div data-role="navbar" data-iconpos="top">
                <ul>
                    <li>
                        <a data-ajax="false" href="index.html" data-theme="b" data-icon="headerbtn6">每日推荐
                        </a>
                    </li>
                    <li>
                        <a data-ajax="false" href="list.html" data-theme="b" data-icon="headerbtn1">卖场
                        </a>
                    </li>
                    <li>
                        <a data-ajax="false" href="my.html" data-theme="b" data-icon="headerbtn2" class="ui-btn-active">我的
                        </a>
                    </li>
                    <li>
                        <a data-ajax="false" href="search.html" data-theme="b" data-icon="headerbtn3">搜索
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </div>

</body>
</html> 